import request from '@/utils/request.js'

export function getCommentList(page, size, searchParams) {
  console.log('page',page,'size',size)
  return request.get(`/comments/list/${page}/${size}`, {
    params: {
      relateName: searchParams?.relateName,
      delFlag: searchParams?.status
    }
  })
}

/**
 * 删除评论id
 * @param commentId
 */
export function remove(commentId) {
  return request.delete(`/comments/remove/${commentId}`)
}
/**
 * 批量删除评论信息
 *
 * @param ids
 */
export function removeBatchByCommentsIds(commentsIds) {
  console.log('批量删除评论信息ids=====',commentsIds)
  return request.delete('/comments/batch', {
    data: commentsIds
  })
}
/**
 * 新增评论信息
 * @param comments
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export function addComment(comments) {
  return request.comments('/comments/add', comments)
}
/**
 * 修改评论信息
 * @param userInfo
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export function updateComment(comments) {
  console.log('修改评论信息11111',comments)
  return request.put('/comments/update', comments)
}

/**
 * 详情
 * @param commentId
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export function detail(commentId) {
  return request.get(`/comments/detail/${commentId}`)
}
